import request from '@/utils/request'

// 查询客户信息列表
export function listCustinfo(query) {
  return request({
    url: '/crmsys/custinfo/list',
    method: 'get',
    params: query
  })
}
// 查询公共库列表
export function listPublicCustlist(query) {
  return request({
    url: '/crmsys/custinfo/publicCustlist',
    method: 'get',
    params: query
  })
}
// 查询公共库列表
export function publicCustFetchlist(query) {
  return request({
    url: '/crmsys/custinfo/publicCustFetchlist',
    method: 'get',
    params: query
  })
}

// 查询公共库参数配置
export function getPublicCustSet() {
  return request({
    url: '/crmsys/custinfo/getPublicCustSet',
    method: 'get'
  })
}


// 查询客户信息详细
export function getCustinfo(id) {
  return request({
    url: '/crmsys/custinfo/' + id,
    method: 'get'
  })
}

// 新增客户信息
export function addCustinfo(data) {
  return request({
    url: '/crmsys/custinfo',
    method: 'post',
    data: data
  })
}

// 修改客户信息
export function updateCustinfo(data) {
  return request({
    url: '/crmsys/custinfo',
    method: 'put',
    data: data
  })
}

// 删除客户信息
export function delCustinfo(id) {
  return request({
    url: '/crmsys/custinfo/' + id,
    method: 'delete'
  })
}

// 删除客户信息
export function decryptMobile(data) {
  return request({
    url: '/crmsys/custinfo/decryptMobile',
    method: 'post',
    data: data
  })
}

// 新增客户信息
export function setFetchConfig(data) {
  return request({
    url: '/crmsys/custinfo/setFetchConfig',
    method: 'post',
    data: data
  })
}


// 客户加入我的再分配客户池
export function fetchCustToMyReCust(id) {
  return request({
    url: '/crmsys/custinfo/fetchCustToMyReCust/' + id,
    method: 'post'
  })
}

// 查询我的客户库列表
export function getMyCustlist(query) {
  return request({
    url: '/crmsys/custinfo/getMyCustlist',
    method: 'get',
    params: query
  })
}
// 查询我的客户库列表
export function getMyCustInfo(query) {
  return request({
    url: '/crmsys/custinfo/getMyCustInfo',
    method: 'get',
    params: query
  })
}


// 打开新数据接收
export function setReceiveNewDataFlag(status) {
  return request({
    url: '/crmsys/custinfo/setReceiveNewDataFlag/' + status,
    method: 'post'
  })
}
// 加入必跟进客户池
export function batchUpdateToMust(ids) {
  return request({
    url: '/crmsys/custinfo/batchUpdateToMust/' + ids,
    method: 'post'
  })
}
// 加入我的客户
export function batchUpdateToMy(ids) {
  return request({
    url: '/crmsys/custinfo/batchUpdateToMy/' + ids,
    method: 'post'
  })
}
// 加入公共池
export function batchUpdateToPublic(ids) {
  return request({
    url: '/crmsys/custinfo/batchUpdateToPublic/' + ids,
    method: 'post'
  })
}

// 加入垃圾库
export function batchRemoveToRefusePool(ids) {
  return request({
    url: '/crmsys/custinfo/batchRemoveToRefusePool/' + ids,
    method: 'post'
  })
}

// 回收至负责人名下
export function batchCustTakeBack(ids) {
  return request({
    url: '/crmsys/custinfo/batchCustTakeBack/' + ids,
    method: 'post'
  })
}
// 回收至待分配
export function batchToBeAllocated(ids) {
  return request({
    url: '/crmsys/custinfo/batchToBeAllocated/' + ids,
    method: 'post'
  })
}

// 查询待分配客户信息列表
export function unDistriCustlist(query) {
  return request({
    url: '/crmsys/custinfo/unDistriCustlist',
    method: 'get',
    params: query
  })
}
// 查询可以分配的人员信息
export function queryUser(query) {
  return request({
    url: '/crmsys/custinfo/queryUser',
    method: 'get',
    params: query
  })
}

// 更新同步数据状态
export function updateDistributeSwitchStatus(status) {
  return request({
    url: '/crmsys/custinfo/updateDistributeSwitchStatus/' + status,
    method: 'post'
  })
}



// 获取部门归属
export function getAllDept() {
  return request({
    url: '/crmsys/custinfo/getAllDept',
    method: 'get'
  })
}

// 获取部门归属和人员信息
export function getAllDeptandUsers() {
  return request({
    url: '/crmsys/custinfo/getAllDeptandUsers',
    method: 'get'
  })
}

// 查询客户信息详细
export function newDataDistr(custIds,empIds) {
  return request({
    url: '/crmsys/custinfo/newDataDistr/' + custIds+"/"+empIds,
    method: 'post'
  })
}


// 查询所有客户列表
export function allCustlist(query) {
  return request({
    url: '/crmsys/custinfo/allCustlist',
    method: 'get',
    params: query
  })
}


// 查询团队客户
export function teamCustlist(query) {
  return request({
    url: '/crmsys/custinfo/teamCustlist',
    method: 'get',
    params: query
  })
}
// 查询离职人员客户
export function withdrawnCustlist(query) {
  return request({
    url: '/crmsys/custinfo/withdrawnCustlist',
    method: 'get',
    params: query
  })
}

// 公共池/团队客户/离职客户数据分配
export function publicDataDistr(custIds,empIds,withdrawn) {
  return request({
    url: '/crmsys/custinfo/publicDataDistr/' + custIds+"/"+empIds+"/"+withdrawn,
    method: 'post'
  })
}
// 公共池/团队客户/离职客户数据分配
export function batchRemoveToCustInfoDel(custIds,withdrawn) {
  return request({
    url: '/crmsys/custinfo/batchRemoveToCustInfoDel/' + custIds+"/"+withdrawn,
    method: 'post'
  })
}

// 查询垃圾池客户
export function deleteCustlist(query) {
  return request({
    url: '/crmsys/custinfo/deleteCustlist',
    method: 'get',
    params: query
  })
}
// 查询垃圾中间库
export function deletingCustlist(query) {
  return request({
    url: '/crmsys/custinfo/deletingCustlist',
    method: 'get',
    params: query
  })
}


// 垃圾中间库数据审核
export function deletingCustPass(custIds) {
  return request({
    url: '/crmsys/custinfo/deletingCustPass/' + custIds,
    method: 'post'
  })
}



// 查询待点评客户信息
export function tobeReviewedCustlist(query) {
  return request({
    url: '/crmsys/custinfo/tobeReviewedCustlist',
    method: 'get',
    params: query
  })
}
// 拨打电话
export function callPhone(id) {
  return request({
    url: '/phone/callPhone/'+id,
    method: 'get'
  })
}



// 获取未处理客户信息
export function getNotProcessedCust(userId) {
  return request({
    url: '/phone/getNotProcessedCust/' + userId,
    method: 'get'
  })
}
// 获取未处理客户信息
export function getNotProcessedCustTotal(userId) {
  return request({
    url: '/phone/getNotProcessedCustTotal/' + userId,
    method: 'get'
  })
}
// 获取所有未指派数据
export function getNotAssignedCust(userId) {
  return request({
    url: '/phone/getNotAssignedCust/' + userId,
    method: 'get'
  })
}

// 查询客户数据
export function getCustList(query) {
  return request({
    url: '/crmsys/custinfo/getCustList',
    method: 'get',
    params: query
  })
}
